#include <bits/stdc++.h>

using namespace std;


class Solution {
public:
    bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {
        stack<int> s;
        int plen=pushed.size(),polen=popped.size(),poindex=0;
        if(plen!=polen) return false;
        for(int i=0;i<plen;i++){
            s.push(pushed[i]);
            while(!s.empty() && s.top()==popped[poindex]){
                s.pop();
                poindex++;
            }
        }

        return s.empty();
    }
};

int main(){




    return 0;
}